/**
 * Copyright (c) 2018, wuyy All rights reserved.
 * wuyy 专有/保密源代码,未经许可禁止任何人通过任何渠道使用、修改源代码.
 * QQ:16349023
 * 项目名称 : com.wy2.eclipse.tool.ui
 * @version V1.0
 */
package com.wy2.eclipse.tool.ui.editors;

import java.text.MessageFormat;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
import com.wy2.core.date.DateTime;
import com.wy2.core.tool.DatetimeTools;
import com.wy2.eclipse.tool.lib.entity.TemplateConfig;
import com.wy2.eclipse.tool.lib.entity.TemplateItem;

/**
 * @author wuyy<16349023@qq.com>
 * @date 2018年1月22日下午8:29:01
 * 
 */
public class CodeTemplateLabelProvider implements ILabelProvider {

    /** 
     * @param listener 
     * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
     */
    @Override
    public void addListener(ILabelProviderListener listener) {
        // TODO Auto-generated method stub

    }

    /** 
     *  
     * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
     */
    @Override
    public void dispose() {
        // TODO Auto-generated method stub

    }

    /** 
     * @param element
     * @param property
     * @return 
     * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
     */
    @Override
    public boolean isLabelProperty(Object element, String property) {
        // TODO Auto-generated method stub
        return false;
    }

    /** 
     * @param listener 
     * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
     */
    @Override
    public void removeListener(ILabelProviderListener listener) {
        // TODO Auto-generated method stub

    }

    /** 
     * @param element
     * @return 
     * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
     */
    @Override
    public Image getImage(Object element) {
        // TODO Auto-generated method stub
        return null;
    }

    /** 
     * @param element
     * @return 
     * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
     */
    @Override
    public String getText(Object element) {
        if(element instanceof TemplateItem) {
            TemplateItem item=(TemplateItem) element;
            return MessageFormat.format("{0}-{1} By {2}", item.getTemplateName(), item.getVersion(), DatetimeTools.getDatetime(item.getUpdateTime(), "yyyy-MM-dd HH:mm:ss") );             
        }
        return null;
    }

}
